package com.example.demo.LeetCode.dynamic;

public class ClimbStairs {
    public static int solution(int n){
        int dp[] = new int[n+1];
        int m = 3;
        dp[0] = 1;
        for (int i = 1; i <= n ;i++){
            for (int j = 1 ; j <= m ;j++){
                if (i >= j ){
                    dp[i]+= dp[i-j];
                }
            }
        }
        return dp[n];
    }

    public static void main(String[] args) {
        System.out.println(solution(1));
        System.out.println(solution(2));
        System.out.println(solution(3));
        System.out.println(solution(4));
        System.out.println(solution(5));
    }
}
